package com.senlingspace.payment.enums;

/**
 * 拉卡拉用户支付银行卡类型
 *
 * @author lebronjames
 * @date 2024/07/24
 */
public enum LakalaCardTypeEnum {

    DEBIT("00", "借记"),
    CREDIT("01", "贷记"),
    WECHAT_BALANCE("02", "微信零钱"),
    ALIPAY_HUABEI("03", "支付宝花呗"),
    ALIPAY_OTHER("04", "支付宝其他"),
    DIGITAL_CURRENCY("05", "数字货币"),
    LAKALA_ACCOUNT("06", "拉卡拉支付账户"),
    UNKNOWN("99", "未知");

    private final String code;
    private final String description;

    LakalaCardTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static LakalaCardTypeEnum fromCode(String code) {
        for (LakalaCardTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown card type code: " + code);
    }

}
